<template>
  <div class="app-container">
    <TisTable
      :columns="column"
      :filters="filterColums"
      :url="'logservice/AppLogQuery/GetLogList'"
    >
      <!-- <el-table-column slot="operateT" label="操作" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="edit(scope.row)" />
        </template>
      </el-table-column> -->
      <el-table-column slot="operateT" :label="$t('table.actions')" align="center" width="230" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            type="primary"
            size="mini"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
          >编辑</el-button>

          <el-popconfirm
            title="您确定要删除该用户吗?"
            placement="top"
            style="margin-left: 10px"
            @onConfirm="handleDelete(scope.row)"
          >
            <el-button
              slot="reference"
              size="mini"
              type="danger"
              icon="el-icon-delete"
            >
              删除</el-button>
          </el-popconfirm>

          <el-badge :is-dot="false" size="mini">
            <el-dropdown size="mini" style="margin-left: 10px">
              <el-button type="primary" size="mini" class="filter-item">
                更多
                <i class="el-icon-arrow-down el-icon--right" />
              </el-button>
              <el-dropdown-menu
                slot="dropdown"
                style="width: 95px; padding: 5px 0"
              >
                <el-badge :is-dot="false" size="mini" class="item">
                  <el-dropdown-item @click.native="handleResetPwd(scope.row)">
                    <svg-icon
                      icon-class="password"
                    />&nbsp;重置密码</el-dropdown-item>
                </el-badge>
                <el-badge :is-dot="false" size="mini" class="item">
                  <el-dropdown-item
                    v-if="scope.row.FrozenFlag == 1"
                    @click.native="handleModifyStatus(scope.row, 'freeze')"
                  >
                    <svg-icon
                      icon-class="freeze"
                    />&nbsp;冻结</el-dropdown-item>
                  <el-dropdown-item
                    v-if="scope.row.FrozenFlag == 0"
                    @click.native="handleModifyStatus(scope.row, 'activate')"
                  >
                    <svg-icon icon-class="activate" />&nbsp;激活
                  </el-dropdown-item>
                </el-badge>
                <el-badge :is-dot="false" size="mini" class="item">
                  <el-dropdown-item
                    @click.native="handleLook(scope.row)"
                  ><svg-icon
                    icon-class="look"
                  />&nbsp;查看</el-dropdown-item>
                </el-badge>
              </el-dropdown-menu>
            </el-dropdown>
          </el-badge>
        </template>
      </el-table-column>

      <el-table-column slot="operateT" :label="'操作'" align="center" width="230" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="danger" @click="handleDelete(scope.row)">
            删除
          </el-button>
        </template>
      </el-table-column>
    </TisTable>
  </div>
</template>

<script>

export default {
  name: 'SystemLog',
  data() {
    return {
      column: [
        {
          type: 'selection'
        },
        {
          field: 'id',
          label: 'id',
          width: '50'
        },
        {
          slot: 'operateT'
        },
        {
          field: 'appname',
          label: 'appname',
          width: '80',
          render: (h, params) => {
            const result = params.row.appname
            // return h('div', {}, result)
            return (<el-button type='text' key={params.row.id} onclick={() => this.test(result)}>{result} </el-button>)
          }
        },
        {
          field: 'clientIpAddress',
          label: 'clientIpAddress',
          width: '80',
          formatter: function(row) {
            return 'hhh' + row.clientIpAddress
          }
        },
        {
          field: 'createTime',
          label: 'createTime',
          width: '80'
        },
        {
          field: 'exceptionMessage',
          label: 'exceptionMessage',
          width: '80'
        },
        {
          field: 'invokerMethod',
          label: 'invokerMethod',
          width: '80'
        },
        {
          field: 'invokerType',
          label: 'invokerType',
          width: '180'
        },
        {
          field: 'level',
          label: 'level',
          width: '80'
        },
        {
          field: 'loginAccount',
          label: 'loginAccount',
          width: '80'
        },
        {
          field: 'message',
          label: 'message',
          width: '80'
        },
        {
          field: 'origin',
          label: 'origin',
          width: '80'
        },
        {
          field: 'serverComputerName',
          label: 'serverComputerName',
          width: '80'
        },
        {
          field: 'serverIpAddress',
          label: 'serverIpAddress',
          width: '80'
        },
        {
          field: 'serverOsVersion',
          label: 'serverOsVersion',
          width: '80'
        },
        {
          field: 'sysUserName',
          label: 'sysUserName',
          width: '80'
        },
        {
          field: 'username',
          label: 'username',
          width: '80'
        }

      ],
      filterColums: [
        { field: 'appname', pre: '请输入appname值', value: null },
        { field: 'username', pre: '请输入username值', value: null }
      ]
    }
  },
  methods: {
    handleDelete(scope) {
    },
    test(row) {
      // alert(row)
    }
  }
}
</script>
